#include "mainwindow.h"
#include "plotter.h"
#include "plottersettings.h"
#include <QApplication>
#include<QVector>
#include<QMap>
#include<QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    //初始化数据
    int num = 100;
    QMap<int, QVector<QPointF>> map;
    //不要这样初始化QVector<QPointF> v(num)，会默认往里面填充num个QPointF
    //会使用默认的构造函数初始化QPointF
    //应该像下面这样初始化
    QVector<QPointF> v;
    for(int i = 0; i < num; i++){
        //v.append(QPointF(i, qrand() % 100));//没有通过qsrand(uint seed)设置种子，则种子为1
        v.append(QPointF(i, i * 2));
    }
    /*for(int i = 0; i < v.size(); i++){
        qDebug() << "v[i]" << v[i];
    }*/
    map.insert(0, v);

    //初始化PlotterSettings
    PlotterSettings settings;
    settings.minX = 0;
    settings.maxX = num;
    settings.minY = 0;
    settings.maxY = num * 2;
    settings.numXTicks = 10;
    settings.numYTicks = 10;

    Plotter plotter;
    plotter.setData(map);
    plotter.setPlotterSetttings(settings);
    w.setCentralWidget(&plotter);
    w.show();

    return a.exec();
}
